Avoid a critical under weston
authorMatthias Clasen <mclasen@redhat.com>
Tue, 12 May 2015 02:13:07 +0000 (22:13 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 12 May 2015 02:13:07 +0000 (22:13 -0400)
The ordering of globals in connection setup under weston
is different from mutter, and we end up creating a the
dnd window before any outputs are present. Don't cause
a critical warning in that case.

gdk/wayland/gdkwindow-wayland.c

index a4e1df436e24ecf26e5a714052e8efe03d08ca37..507013c5d51ad132336c288534c3ecd8ad723459 100644 (file)
@@ -495,7 +495,8 @@ _gdk_wayland_display_create_window_impl (GdkDisplay    *display,
   g_object_ref (window);
 
   /* More likely to be right than just assuming 1 */
-  if (wayland_display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE)
+  if (wayland_display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
+      gdk_screen_get_n_monitors (screen) > 0)
     impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
 
   impl->title = NULL;